import request from '../../utils/request'

/**
     * 保存交接单
     *
     * @param deliveryReceiptForm
     * @return
     */
    export async function createDeliveryReceipt( data ) {
        return request(apiPath.mc + "/api/deliveryReceipt", {
            method: 'post',
            data
        });
    }

     /**
     * 修改交接单
     *
     * @param deliveryReceiptForm
     * @return
     */
    export async function updateDeliveryReceipt( data ) {
        return request(apiPath.mc + "/api/deliveryReceipt", {
            method: 'put',
            data
        });
    }

     /**
     * 审核交接单
     *
     * @param deliveryReceiptForm
     * @param bindingResult
     * @return
     */
    export async function ApprovalDeliveryReceipt( data ) {
        return request(apiPath.mc + "/api/deliveryReceipt/approval", {
            method: 'put',
            data
        });
    }

    /**
     * 删除交接单
     *
     * @param id
     * @return
     */
    export async function deleteById({ id }){
        return request(apiPath.mc + "/api/deliveryReceipt/" + id,{
            method: 'delete'
        });
    }

     /**
     * 根据id获取交接单
     *
     * @param id
     * @return
     */
    export async function getById({ id }){
        return request(apiPath.mc +  "/api/deliveryReceipt/" + id,{
            method: 'get'
        });
    }

     /**
     * 分页查询交接单
     *
     * @param orderNo
     * @param soNo
     * @param drBeginTime
     * @param drEndTime
     * @param bkBeginTime
     * @param bkEndTime
     * @param loadingPort
     * @param destinationPort
     * @param cstName
     * @param page
     * @return
     */
    export async function getListForPage({  orderNo, soNo, drBeginTime, drEndTime, bkBeginTime, bkEndTime, loadingPort, destinationPort,
         cstName, drStatus, orderStatus, berthingName, ywUser, gdUser, page }) {
        return request(apiPath.mc + "/api/deliveryReceipt", {
            method: 'get',
            data: { orderNo, soNo, drBeginTime, drEndTime, bkBeginTime, bkEndTime, loadingPort, destinationPort,
                cstName, drStatus, orderStatus, berthingName, ywUser, gdUser, page: page.page, size: page.size }
        });
    }

    /**
     * 根据status获取当前用户的交接单
     *
     * @param status
     * @return
     */
    export async function getUserDeliveryReceipt({ status }) {
        return request(apiPath.mc + "/api/user/deliveryReceipts", {
            method: 'get',
            data: { status }
        });
    }

    /**
     * 复制交接单
     *
     * @param id
     * @return
     */
    export async function copyDeliveryReceipt({ id }) {
        return request(apiPath.mc + "/api/copy/deliveryReceipt", {
            method: 'get',
            data: { id }
        });
    }
